<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>论坛页面</title>
<style>
.footer {
	clear: both;
}

.footer p {
	text-align: center;
}

.nav p {
	text-align: right
}

.nav nav {
	text-align: right
}
.table .sp1{text-align: center;width:150px;font-weight:bold;}
.sp2{width: 80px;font-weight: bold;text-align: right;}
</style>
<!-- Bootstrap -->
<link href="Content/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
	<div class="container">
<%@ include file="/shared/header.jsp"  %>
		<div id="path">
			<ol class="breadcrumb">
				<li><a href="index.htm">首页</a>
				</li>
				<li><a href="register.html">${forum.name }</a>
				</li>
				<li>${topic.title }</li>
			</ol>
		</div>
		<div id="content">

			<table class="table table-bordered">
				<c:if test="${pageNum<2 }">
					<tr>
						<td class="sp1">昵称:${topic.user.nickname }</td>
						<td>标题:${topic.title }</td>
					</tr>
					<tr>
						<td><img src="Content/pictures/user/${topic.user.filename }" />
						</td>
						<td>${topic.content }</td>
					</tr>
				</c:if>
				<c:forEach items="${comment}" var="c">
					<tr>
						<td class="sp1">昵称:${c.user.nickname }</td>
						<td>${c.id+1 } 楼</td>
					</tr>
					<tr>
						<td><img src="Content/pictures/user/${c.user.filename }" />
						</td>
						<td>${c.content }</td>
					</tr>
				</c:forEach>
			</table>

			<div class="nav">
				<nav aria-label="...">
					<ul class="pagination">
						<c:if test="${pageNum>1}">
                	<li class="active"><a href="CommentServlet?pageNum=${pageNum-1}&referenceId=${referenceId}" aria-label="Previous"><span aria-hidden="true">&lt;</span></a></li>
                </c:if>
                <c:if test="${pageNum<=1}">
                    <li class="disabled"><a href="CommentServlet?pageNum=${pageNum }&referenceId=${referenceId}" aria-label="Previous"><span aria-hidden="true">&lt;</span></a></li>
                </c:if>
                <c:if test="${pageNum<totalPage }">
                    <li class="active"><a href="CommentServlet?pageNum=${pageNum+1 }&referenceId=${referenceId}">&gt;<span class="sr-only">(current)</span></a></li>
                </c:if>
                <c:if test="${pageNum>=totalPage }">
                    <li class="disabled"><a href="CommentServlet?pageNum=${pageNum }&referenceId=${referenceId}">&gt;<span class="sr-only">(current)</span></a></li>
                </c:if>
					</ul>
				</nav>
				<p>共${totalPage }页，第${pageNum }页</p>
			</div>

			<c:if test="${not empty user}">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">回复</h3>
				</div>
				<div class="panel-body">
						<!-- Default panel contents -->
						<div class="col-mg-10">
						<form action="SaveCommentServlet" method="post">
						<table>
						<tr>
						<td class="sp2">内容：</td>
						<td><textarea class="form-control" rows="3" cols="70" name="content"></textarea></td>
						</tr>
						<tr>
						<td><input type="hidden" value="${referenceId }" name="reference"/></td>
						<td><button type="submit" class="btn btn-default" style="margin-top: 10px;">发表</button></td>
						</tr>
						</table>
						</form>
						</div>

				</div>
			</div>
			</c:if>

		</div>
		    <%@ include file="/shared/footer.jsp" %>
	</div>

	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script src="Content/bootstrap/jquery/jquery-1.11.3.js"></script>
	<!-- Include all compiled plugins (below), or include individual files as needed -->
	<script src="Content/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
